home *** CD-ROM | disk | FTP | other *** search
/ BMUG PD-ROM A / PD-ROM A.iso / Programming / Programming Languages / MacOberon / MacOberon (tools) / RX.Tool (.txt) < prev    next >
Encoding:
Oberon Text  |  1990-12-20  |  2.5 KB  |  67 lines  |  [.Ob./.Ob2]

  1. Syntax10.Scn.Fnt
  2. Syntax12b.Scn.Fnt
  3. RX.SetSearch 
  4. RX.SetReplace
  5. RX.Search
  6. RX.Replace
  7. RX.ReplaceAll
  8. RX.Grep 
  9. -----------------------------------------------------------
  10. Regular Expression Search and Replace Commands
  11. RX.SetSearch [option] RegExpr
  12. Sets RegExpr as the current search pattern. 
  13. The end of RegExpr is determined by the end of the command line.
  14. Up to ten factors can be marked as subexpressions.
  15.         RegExpr         =    term { "|" term }.
  16.         term              =    extdfactor { extdfactor }.
  17.         extdfactor     =    factor [ subexprid ].
  18.         factor            =    "(" RegExpr ")" | "[" RegExpr "]" | "{ RegExpr "}" | 
  19.                                     ["~"] ( """ literal """ | shorthand ) | """ literal { literal } """.
  20.         subexprid      =    "X" digit.
  21.         shorthand      =    "A" | "a" | "b" | "c" | "d" | "h" | "i" | "l" | "o" | "t" | "w".
  22.         option           =    "/c".
  23. Predefined character classes and their meaning :
  24.     A    :     "A" - "Z"
  25.     a    :     "a" - "z"
  26.     b    :     "0" - "1"
  27.     c    :      carriage return
  28.     d    :     "0" - "9"
  29.     h    :     "0" - "9" or "A" - "F"
  30.     l     :     character classes A or a
  31.     i     :     character classes l or d
  32.     o    :     "0" - "7"
  33.     t     :     tab
  34.     w   :     tab, carriage return or blank
  35. Option c ignores the case of the letters
  36. RX.SetReplace {""" literal {literal} """ | subexprid | "t" | "c"}
  37. Defines the current replace pattern as a sequence of strings,
  38. subexpressions, tabulator or carriage return characters.
  39. RX.Search
  40. Searches the current search pattern in the focused text. Searching is started at the
  41. position of the caret. If the caret doesn't exist in the focused text, searching
  42. starts at the beginning. The command searches for the longuest pattern,
  43. matching the regular expression ( the same rule is applied to subexpressions ).
  44. RX.Replace
  45. Replaces a found regular expression by the current replace pattern and
  46. searches for the next occurence of the current search pattern.
  47. RX.ReplaceAll
  48. Repeats RX.Replace until the end of text.
  49. The Grep Command
  50. RX.Grep ( filename | "*" ) [option] RegExpr
  51. Searches in the file filename or the marked text for the regular expression
  52. RegExpr. The output will be diplayed in a seperate text viewer.
  53.     option    =    "/" { "c" | "i" }.
  54. Options :
  55.     c    :    Ignores the case of the letters
  56.     i    :    Invert the search and displays only the lines that do not match
  57. Examples
  58. indent (non empty) lines by one tab
  59.     RX.SetSearch (~c {~c} c) X0
  60.     RX.SetReplace t X0
  61. display all procedure headers
  62.     RX.Grep Texts.Mod "PROCEDURE"
  63. generate the parameters for a System.CopyFiles or System.RenameFiles
  64. command from a directory listing
  65.     RX.SetSearch ( i {i|"."} ) X0
  66.     RX.SetReplace X0 " => prefix." X0
  67.